package cn.schoolwow.workflow.test.module.initial.database;

import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
import com.zaxxer.hikari.HikariDataSource;

public class SetPostgreDataSourceFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        HikariDataSource hikariDataSource = new HikariDataSource();
        hikariDataSource.setDriverClassName("org.postgresql.Driver");
        hikariDataSource.setJdbcUrl("jdbc:postgresql://127.0.0.1:5432/quickWorkFlow?stringtype=unspecified");
        hikariDataSource.setUsername("postgres");
        hikariDataSource.setPassword("123456");
        flowContext.putTemporaryInstanceData(hikariDataSource, HikariDataSource.class);
    }

    @Override
    public String name() {
        return "设置postgre数据库连接池";
    }
}
